#pragma once

using namespace swegl;

class myIDirect3DSurface9 : public IDirect3DSurface9
{
    SWEGL_DXWRAPPER_DECLARE_IUNKNOWN(myIDirect3DSurface9, IDirect3DSurface9);
	SWEGL_DXWRAPPER_DECLARE_RESOURCE(myIDirect3DSurface9, IDirect3DSurface9);

    HRESULT __stdcall GetContainer(REFIID riid, void** ppContainer);
    HRESULT __stdcall GetDesc(D3DSURFACE_DESC *pDesc);
    HRESULT __stdcall LockRect(D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
    HRESULT __stdcall UnlockRect();
    HRESULT __stdcall GetDC(HDC *phdc);
    HRESULT __stdcall ReleaseDC(HDC hdc);

	myIDirect3DSurface9(Surface *surface);
	~myIDirect3DSurface9();

	Surface *m_surface;
};

class myIDirect3DTexture9 : public IDirect3DTexture9
{
public:
    SWEGL_DXWRAPPER_DECLARE_IUNKNOWN(myIDirect3DTexture9, IDirect3DTexture9);
	SWEGL_DXWRAPPER_DECLARE_RESOURCE(myIDirect3DTexture9, IDirect3DTexture9);

    DWORD __stdcall SetLOD(DWORD LODNew);
    DWORD __stdcall GetLOD();
    DWORD __stdcall GetLevelCount();
    HRESULT __stdcall SetAutoGenFilterType(D3DTEXTUREFILTERTYPE FilterType);
    D3DTEXTUREFILTERTYPE __stdcall GetAutoGenFilterType();
    void __stdcall GenerateMipSubLevels();
    HRESULT __stdcall GetLevelDesc(UINT Level,D3DSURFACE_DESC *pDesc);
    HRESULT __stdcall GetSurfaceLevel(UINT Level,IDirect3DSurface9** ppSurfaceLevel);
    HRESULT __stdcall LockRect(UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
    HRESULT __stdcall UnlockRect(UINT Level);
    HRESULT __stdcall AddDirtyRect(CONST RECT* pDirtyRect);


	myIDirect3DTexture9(swegl::Texture *tex);
	~myIDirect3DTexture9();

//private:
	swegl::Texture *m_tex;
	std::vector<myIDirect3DSurface9 *> m_surfaces;
};
